package com.gxsyh.nantie.dining.provider.service.impl;

import com.gxsyh.nantie.dining.provider.domain.TbDepartmentSubsidy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.gxsyh.nantie.dining.provider.mapper.TbDepartmentSubsidyMapper;
import com.gxsyh.nantie.dining.provider.service.TbDepartmentSubsidyService;
import tk.mybatis.mapper.entity.Example;

/**
 * @email yom535@outlook.com
 * @author: 刘锋嘉(Liu Fengjia)
 * @date: 2020/1/8
 * @time: 16:31
 * @Description: 
 */
@Service
public class TbDepartmentSubsidyServiceImpl implements TbDepartmentSubsidyService{

    @Resource
    private TbDepartmentSubsidyMapper tbDepartmentSubsidyMapper;

    @Override
    public int deleteByDepartmentId(Long departmentId) {
        Example example=new Example(TbDepartmentSubsidy.class);
        example.createCriteria().andEqualTo("departmentId",departmentId);
        return tbDepartmentSubsidyMapper.deleteByExample(example);
    }

    @Override
    public int insterByDepartmentId(Long id,Long departmentId, Long subsidyId) {
        TbDepartmentSubsidy tbDepartmentSubsidy=new TbDepartmentSubsidy();
        tbDepartmentSubsidy.setId(id);
        tbDepartmentSubsidy.setDepartmentId(departmentId);
        tbDepartmentSubsidy.setSubsidyId(subsidyId);

        return tbDepartmentSubsidyMapper.insert(tbDepartmentSubsidy);
    }
}
